from selenium.webdriver.remote.webdriver import WebDriver
from selenium.webdriver.remote.webelement import WebElement
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as ec
import time

class Base:
    def __init__(self,driver: WebDriver):
        self.driver=driver
    def open_url(self,url):
        self.driver.get(url)
    def find_element(self,loc)-> WebElement:
        return WebDriverWait(self.driver,20,0.5).until(ec.presence_of_element_located(loc))

    def click(self,loc):
        self.find_element(loc).click()
    def fill(self,loc,info):
        self.find_element(loc).send_keys(info)
    def sleep(self,writ_time):
        time.sleep(writ_time)
